enum Code {
  SUCCESS = 200,
  SERVER_ERROR = 500
}
export class ResResult {
  static success(data: any = undefined, msg: any = '') {
    const code: Code = Code.SUCCESS
    return {
      code,
      data,
      msg
    }
  }

  static fail(msg: any = '') {
    const code: Code = Code.SERVER_ERROR
    return {
      code,
      data: undefined,
      msg
    }
  }
}

export const { success, fail } = ResResult
